<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@page import="vn.edu.hungvuongaptech.dao.ProjectDAO"%>
<%@page import="vn.edu.hungvuongaptech.dao.StatusDAO"%>
<%@page import="vn.edu.hungvuongaptech.dao.TimeSheetDAO"%>
<%@page import="vn.edu.hungvuongaptech.common.Constant"%>
<fmt:bundle basename="i18n">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/general.css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/aqua.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/General.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/zapatec.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/calendar.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/calendar-en.js"></script>
<title>TimeSheet</title>
</head>
<body>
	<div id="main-wrap">
		<!-- S HEAD CONTENT -->
			<jsp:include page="../block/header.jsp" />
		<!-- E HEAD CONTENT -->

		<div class="space"></div>

		<!-- S BODY CONTENT -->
		<div id="body">
			<div id="center-column">
				<!-- Dynamic content place here -->
				<form name="frmSearch" action="FilterTimeSheetController" method="get">
					<table align="center" cellpadding="4" width="100%">
						<tr>
							<td align="right"><fmt:message key="timesheet.combobox.projectLabel" /></td>
							<td><select id="cboProject" name="cboProject">
								<option value="">- All -</option>
							<c:set var="projectList" value="<%= ProjectDAO.getAllProject() %>" />
							<c:forEach items="${projectList}" var="item">
								<option value="${ item.projectId }"> ${ item.projectName } </option>
							</c:forEach>
							</select></td>
							<td align="right"><fmt:message key="timesheet.combobox.statusLabel" /></td>
							<td><select id="cboStatus" name="cboStatus">
								<option value="">- All -</option>
								<c:set var="statusList" value="<%= StatusDAO.getAllStatuses() %>" />
								<c:forEach items="${statusList}" var="item">
									<option value="${ item.statusId }"> ${ item.statusName } </option>
								</c:forEach>
							</select></td>
							<td align="right"><fmt:message key="timesheet.textbox.fromDateLabel" /></td>
							<td><input type="text" name="txtFromDate" id="txtFromDate" size="10" /> <img
								id="imgFromDate" src="../images/view_calendar_day.png" alt="Calendar"
								height="20px" style="margin-bottom: -5px;" /></td>
							<td align="right"><fmt:message key="timesheet.textbox.fromDateLabel" /></td>
							<td><input type="text" name="txtToDate" id="txtToDate" size="10" /> <img
								id="imgToDate" src="../images/view_calendar_day.png" alt="Calendar"
								height="20px" style="margin-bottom: -5px;" /></td>
							<td><input type="submit" name="btnSearch" value="<fmt:message key="timesheet.button.searchLabel" />"
								class="button" /></td>
						</tr>
					</table>
<script type="text/javascript">
//<![CDATA[
  Zapatec.Calendar.setup({
	firstDay          : 1,
	weekNumbers       : false,
	range             : [2010.01, 2020.12],
	electric          : false,
	inputField        : "txtFromDate",
	button            : "imgFromDate",
	ifFormat          : "%m-%d-%Y"
  });
//]]>
//<![CDATA[
  Zapatec.Calendar.setup({
	firstDay          : 1,
	weekNumbers       : false,
	range             : [2010.01, 2020.12],
	electric          : false,
	inputField        : "txtToDate",
	button            : "imgToDate",
	ifFormat          : "%m-%d-%Y"
  });
//]]>
</script>
				</form>
				<div align="center"><h3 style="color:green"><c:if test='${not empty param.msg}'>
							   ${param.msg}
						   </c:if></h3></div>
				<form method="post" action="ConfirmTimeSheetDeletionController">
					<c:set var="timeSheetModels"
							value="<%= TimeSheetDAO.getTimeSheetByUserId(
									Long.parseLong(
											session.getAttribute(Constant.USERID_ATT).toString())) %>" />
					<table width="100%" border="1" cellpadding="2" class="table">
						<tr>
							<th width="15px"> <input type="checkbox" name="chkSelectAll" id="chkSelectAll" alt="Select All" onclick="checkAll(this.name, 'chkTimeSheetID')" /> </th>
							<th width="70px"><fmt:message key="timesheet.table.dateLabel" /></th>
							<th width="35px"><fmt:message key="timesheet.table.timeLabel" /></th>
							<th><fmt:message key="timesheet.table.descriptionLabel" /></th>
							<th><fmt:message key="timesheet.table.productLabel" /></th>
							<th><fmt:message key="timesheet.table.workLabel" /></th>
							<th><fmt:message key="timesheet.table.processLabel" /></th>
							<th><fmt:message key="timesheet.table.statusLabel" /></th>
							<th><fmt:message key="timesheet.table.projectLabel" /></th>
						</tr>
					<c:forEach items="${timeSheetModels}" var="item">
						<tr>
							<td align="center"> <input type="checkbox" name="chkTimeSheetID" id="chkTimeSheetID" alt="${ item.timeSheetId }" value="${ item.timeSheetId }" /> </td>
							<td align="right">${ item.date }</td>
							<td align="right">${ item.time }</td>
							<td>${ item.description }</td>
							<td>${ item.product.productName }</td>
							<td>${ item.work.workName }</td>
							<td>${ item.process.processName }</td>
							<td>${ item.status.statusName }</td>
							<td>${ item.project.projectName }</td>
						</tr>
					</c:forEach>
					</table>
					<div style="padding: 10px;" align="center">
						<input type="button" value="<fmt:message key="timesheet.button.addnewLabel" />" name="btnAddNew" id="btnAddNew" class="button"
							onclick='document.location.href="<%= Constant.PATH_RES.getString("timesheet.staff.addTimeSheetPath") %>"' />
						&nbsp;&nbsp;
						<input type="submit" value="<fmt:message key="timesheet.button.deleteLabel" />" name="btnDelete" id="btnDelete" class="button" />
					</div>
				</form>
				<!-- Dynamic content place here -->
			</div>
		</div>
		<!-- E BODY CONTENT -->

		<div class="space"></div>

		<!-- S FOOT CONTENT -->
			<jsp:include page="../block/footer.jsp" />
		<!-- E FOOT CONTENT -->
	</div>
</body>
</html>
</fmt:bundle>